<template>
  <div>
    <h1>个人中心</h1>
    <ul>
      <li :class="{'active': getActive('/accountmanagement')}" @click="goPage('/accountmanagement')"><img src="../assets/images/icon/icon24.png" alt="">账号管理</li>
      <li :class="{'active': getActive('/orderrecords')}" @click="goPage('/orderrecords')"><img src="../assets/images/icon/icon8.png" alt="">订单记录</li>
      <li :class="{'active': getActive('/paymentinvoice')}" @click="goPage('/paymentinvoice')"><img src="../assets/images/icon/icon10.png" alt="">付款开票</li>
      <li :class="{'active': getActive('/contacts')}" @click="goPage('/contacts')"><img src="../assets/images/icon/icon14.png" alt="">联系人</li>
      <li :class="{'active': getActive('/supplier')}" @click="goPage('/supplier')"><img src="../assets/images/icon/icon11.png" alt="">供应商</li>
      <li :class="{'active': getActive('/importer')}" @click="goPage('/importer')"><img src="../assets/images/icon/icon13.png" alt="">进口商</li>
      <li :class="{'active': getActive('/productlibrary')}" @click="goPage('/productlibrary')"><img src="../assets/images/icon/icon4.png" alt="">产品库</li>
      <li :class="{'active': getActive('/receivingaddress')}" @click="goPage('/receivingaddress')"><img src="../assets/images/icon/icon18.png" alt="">收货地址</li>
      <li :class="{'active': getActive('/fileinformation')}" @click="goPage('/fileinformation')"><img src="../assets/images/icon/icon20.png" alt="">文件信息</li>
      <li :class="{'active': getActive('/consignor')}" @click="goPage('/consignor')"><img src="../assets/images/icon/icon9.png" alt="">发货人</li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'Aside',
  methods: {
    /**
     * 跳转
     */
    goPage (page) {
      this.$router.push(page)
    },

    getActive (page) {
      return page === this.$route.path
    }
  }
}
</script>

<style scoped>
  h1 {
    color: #44a148;
    line-height: 100px;
  }

  h1:after {
    content: '';
    height: 1px;
    background: #ddd;
    display: block;
    width: calc(100% + 20px);
    position: relative;
    left: -20px;
    margin-bottom: 20px;
  }

  ul li {
    line-height: 40px;
    list-style: none;
    cursor: pointer;
  }

  ul li img {
    width: 22px;
    position: relative;
    top: 6px;
    margin-right: 10px;
  }

  li.active {
    color: #44a148;
  }
</style>
